package Day4Zuoye;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("输入文件名:");
        String i=input.nextLine();
        i.endsWith(".txt");
        FileInputStream fin=null;
        try {
            fin=new FileInputStream("C:\\Users\\Administrator\\Desktop\\xinjian\\"+i);
            byte[] b=new byte[fin.available()];//文件不能太大
            int length=0;
            length=fin.read(b);
            System.out.println(new String(b,0,length));
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                fin.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
